package temp.lho.lws.controller;


import com.sun.org.apache.xpath.internal.objects.XString;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;
import temp.lho.lws.status.FlowStatus;

import javax.servlet.http.HttpServletRequest;

/**
 * @author liuws
 * @create 2020-07-03 14:40
 */
@Controller
@RequestMapping
public class SystemController {

    @RequestMapping("/system/toLogin")
    public String toLogin() {
        return "login";
    }

    @RequestMapping("/system/toWelcome")
    public String toWelcome() {
        return "welcome";
    }

    @RequestMapping("/system/unauthorized")
    public String unauthorized() {
        return "unauthorized";
    }

    @RequestMapping("/user/userManager")
    public String toUserManager() {
        return "admin/userManager";
    }

    @RequestMapping("/outDanger/accident")
    public String toUserAccident() {
        return "accident/accident";
    }

    @RequestMapping("/table/add")
    public String toUserAdd() {
        return "accident/table/add";
    }

    @RequestMapping("/table/ReportDispose")
    public String toUserAdd1() {
        return "accident/table/ReportDispose";
    }

    @RequestMapping("/table/CaseReview")
    public String toUseCaseReview() {
        return "accident/table/CaseReview";
    }

    @RequestMapping("/table/DispatchDispatch")
    public String toUseDispatchDispatch() {
        return "accident/table/DispatchDispatch";
    }
    @RequestMapping({"/loss/gtasks" ,"/loss/tempTask" ,"/loss/verify" ,"/loss/sendBack"})
    public String toGrasks(HttpServletRequest request) {
        String servletPath = request.getServletPath();
        request.setAttribute("taskname", FlowStatus.FLOW_LOSS);
        if (servletPath.contains("/gtasks")) {
            request.setAttribute("jobstate",1);
        } else if (servletPath.contains("/tempTask")) {
            request.setAttribute("jobstate",3);
        } else if (servletPath.contains("/verify")) {
            request.setAttribute("jobstate",1);
            request.setAttribute("taskname", FlowStatus.FLOW_VERIFY);
        } else if (servletPath.contains("/sendBack")) {
            request.setAttribute("jobstate",5);
            request.setAttribute("taskname", FlowStatus.FLOW_LOSS);
        }
        return "loss/gtasks";
    }

    @RequestMapping("/loss/survey")
    public String toGrasksSurvey() {
        return "loss/survey";
    }

    @RequestMapping("/outDanger/manager1")
    public String toClaims() {
        return "claims/ClaimsManagement";
    }

    @RequestMapping("/outDanger/manager2")
    public String toAddClaims() {
        return "claims/addClaims";
    }

    @RequestMapping("/policy/manager1")
    public String toPolicies() {
        return "policies";
    }

    @RequestMapping("/toaddwarrr")
    public String toaddwarrr(){ return "addwarrr"; }

    @RequestMapping("/toaddwarr")
    public String  toaddwarr(){
        return "addwarr";
    }

    @RequestMapping("/customer/manager1")
    public String toCustomer() {
        return "/customer/oya";
    }

}
